﻿using B.S.BasicData.ErrorCode;
using B.S.BasicData.Read.Apilication.Common.RolePremiss;
using B.S.BasicData.Read.DTOS;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BasicData.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class RolePremissController : ControllerBase
    {
        private readonly IMediator mediator;

        public RolePremissController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 根据角色查菜单
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<int>>> SetmenuHandle([FromQuery]SetmenuCommon request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 根据登录人显示不同功能
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<RolePremissDTO>>> GetRolePremissHandle([FromQuery]GetRolePremissCommon request)
        {
            return mediator.Send(request);
        }


        }
}
